import request from "@/utils/request";

const api = {
  getlist: "/cms/sysRole/queryPageList",
  add: "/cms/sysRole/save",
  editstatus: "/cms/sysRole/updateStatus",
  deleterole: "/cms/sysRole/remove",
  getuserlist: "/cms/user/queryPageList",
  shuju: "/cms/sysRole/saveUserAuthority",
  caidan: "/cms/sysRole/saveMenuAuthority",
  getcaidan: "/cms/sysMenu/queryTreeList",
  quanxian: "/cms/sysRole/saveDataAuthority",
  juesecaidan: "/cms/sysRole/queryMenuListByRoleId",
  jueseyonghu: "/cms/sysRole/queryUserListByRoleId",
  getusertree: "/cms/common/queryOrganizationUserTree",

  queryUserMenuList: "/cms/sysMenu/queryUserMenuList" //  获取用户菜单表列表
};

//获取角色列表
export function getlist(parameter) {
  return request({
    url: api.getlist,
    method: 'post',
    data: parameter
  })
}

//获取人员树
export function getusertree(parameter) {
  return request({
    url: api.getusertree,
    method: 'post',
    data: parameter
  })
}

//新增角色
export function add(parameter) {
  return request({
    url: api.add,
    method: 'post',
    data: parameter
  })
}

//改变状态
export function editstatus(parameter) {
  return request({
    url: api.editstatus,
    method: 'post',
    data: parameter
  })
}

//删除
export function deleterole(parameter) {
  return request({
    url: api.deleterole,
    method: 'post',
    data: parameter
  })
}

//根据ID获取角色下用户列表
export function jueseyonghu(parameter) {
  return request({
    url: api.jueseyonghu,
    method: 'post',
    data: parameter
  })
}

//获取所有用户列表
export function getuserlist(parameter) {
  return request({
    url: api.getuserlist,
    method: 'post',
    data: parameter
  })
}

//分配数据列表
export function shuju(parameter) {
  return request({
    url: api.shuju,
    method: 'post',
    data: parameter
  })
}

//分配菜单
export function caidan(parameter) {
  return request({
    url: api.caidan,
    method: 'post',
    data: parameter
  })
}

//获取菜单列表
export function getcaidan(parameter) {
  return request({
    url: api.getcaidan,
    method: 'post',
    data: parameter
  })
}

//根据ID查询角色菜单列表
export function juesecaidan(parameter) {
  return request({
    url: api.juesecaidan,
    method: 'post',
    data: parameter
  })
}

//分配权限
export function quanxian(parameter) {
  return request({
    url: api.quanxian,
    method: 'post',
    data: parameter
  })
}

export function queryUserMenuList(parameter) {
  return request({
    url: api.queryUserMenuList,
    method: 'post',
    data: parameter
  })
}


